<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeDecimalLengthToTables extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');
		Schema::table($prefix . 'store_purchase', function (Blueprint $table) {
			$table->decimal('total', 10, 2)->comment('总价')->change();
		});

		Schema::table($prefix . 'store_purchase_item', function (Blueprint $table) {
			$table->decimal('total', 10, 2)->comment('总价')->change();
		});

		Schema::table($prefix . 'store_take_stock', function (Blueprint $table) {
			$table->decimal('difference_amount', 10, 2)->default(0)->comment('盈亏金额')->change();
		});

		Schema::table($prefix . 'store_take_stock_item', function (Blueprint $table) {
			$table->decimal('difference_amount', 10, 2)->default(0)->comment('盈亏金额')->change();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}
}
